/*
 *	CHANGE LOG
 *
 *  01.03.07
 *  
 *      11/30/2009 - DW - Closed the data readers when connections are made to the db. 
 *
*/
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DotNetNuke.Services.Localization;

namespace ITCrossing.Common
{
	public static class CommonServices
	{
		internal static ProviderStruct GetProviderInfo(string moduleName)
		{
			ProviderStruct providerInfo = new ProviderStruct();
			//First, check to see if the provider is stored in the itcMetaPostProviders table
			object[] methodParams = new object[1];
			methodParams.SetValue(moduleName, 0);
            using (IDataReader rdr = DotNetNuke.Data.DataProvider.Instance().ExecuteReader("itcMetaPost_Get_Provider_By_Key", methodParams))
            {
                // Retrieve ProviderDllName, ManifestPath, ManifestFileName from Reader
                if (rdr.Read())
                {
                    providerInfo.ProviderAssemblyName = rdr["ProviderAssemblyName"].ToString();
                    providerInfo.ProviderTypeName = rdr["ProviderTypeName"].ToString();
                    providerInfo.ManifestPath = rdr["ManifestPath"].ToString();
                    providerInfo.DesktopModuleId = rdr.GetInt32(rdr.GetOrdinal("DesktopModuleId"));
                }
            }
			return providerInfo;
		}
	}
}
